﻿/*
·´`·.¸.»------------------------------------------------------------ë·´`·.¸.»
        File: CostellaSuperior.cs
        Project: Themaopdracht 7
        Author: Felix Mann

        Description:
        This algorithm uses Costellas Magic Kernel to upscale the 
        image and then us a Gradient Magnitude to show the difference
        and these differences are, of course, edges.
·´`·.¸.»------------------------------------------------------------ë·´`·.¸.»
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using Costella;

namespace THO7_Team8
{
    class CostellaSuperior : VisionAlgorithm
    {
        public CostellaSuperior(String name) : base(name) { }
        public override System.Drawing.Bitmap DoAlgorithm(System.Drawing.Bitmap sourceImage)
        {
            return new Bitmap(sourceImage).ToPixmap().ToAycc()[1].ToPixmap<double>(z => z).GradientMagnitude().ToPixmap<byte>(z => 2 * z > 255 ? (byte)255 : (byte)Math.Round(2 * z)).ToBitmap();
        }
    }
}
